var express = require('express');
var router = express.Router();
var connection=require('../backjs/node_mysql.js')

//


router.post('/new', function(req, res) {
    console.log("获取新建工程信息")

    // var sql = "INSERT INTO project  (pj_name,pj_manager,pj_company) VALUES (?,?,?)"
    var sql = "INSERT INTO project  (pj_name,pj_manager,pj_company,pj_client," +
        "pj_state,pj_start,pj_fin,pj_addr,pj_description,pj_uid) VALUES (?,?,?,?,?,?,?,?,?,?)"
    var params = [req.body.pj_name, req.body.pj_manager,req.body.pj_company, req.body.pj_client,
        req.body.pj_state,req.body.pj_start,req.body.pj_fin,req.body.pj_addr
        ,req.body.pj_description,req.body.pj_uid]
    console.log(params)

    connection.query(sql, params, function (err, rs) {
        if (err) {
            throw err
        }
        if (rs.length != 0) {
            res.send(200)
        }
        else {
            res.send(400)
        }
    })
});


module.exports = router;